package com.czl.base.data.bean.tengyun

import java.io.Serializable

class OrgBean(
    val orgId: Int? = null,
    val organizationId: Int? = null,
    val parentOrganizationId: Int? = null,
    val orgName: String? = null,
    val companyShortName: String? = null,
    val child: MutableList<OrgBean>? = null
) : Serializable {
}

fun getAllChildOrgList(beanList: MutableList<OrgBean>): MutableList<OrgBean> {
    var returnList: MutableList<OrgBean> = arrayListOf<OrgBean>()
    for (bean in beanList) {
        returnList.add(bean)
        if (bean.child != null && bean.child.isNotEmpty()) {
            returnList.addAll(getAllChildOrgList(bean.child))
        }
    }
    return returnList
}